package com.sfac.hqyj.springBoot.modules.common.controller;

import com.sfac.hqyj.springBoot.modules.common.entity.ResultEntity;
import com.sfac.hqyj.springBoot.modules.common.service.impl.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/api")
public class ImageController {
    @Autowired
    private ImageService imageService;

    /**
     * 127.0.0.1/api/image/profile_big ---- post
     */
    @PostMapping(value = "/image/{imageType}", consumes = "multipart/form-data")
    public ResultEntity<String> uploudImage(@RequestParam("image") MultipartFile image,
                                            @PathVariable String imageType) {
        return imageService.uploadImage(image, imageType);
    }
}
